home *** CD-ROM | disk | FTP | other *** search
- /* xlbind - xlisp symbol binding routines */
-
- #ifdef CI_86
- #include "a:stdio.h"
- #include "xlisp.h"
- #endif
-
- #ifdef AZTEC
- #include "a:stdio.h"
- #include "xlisp.h"
- #endif
-
- #ifdef unix
- #include <stdio.h>
- #include <xlisp.h>
- #endif
-
-
- /* global variables */
-
- struct node *xlenv;
-
-
- /********************************************************
- * xlunbind - unbind symbols bound in this environment *
- ********************************************************/
-
- xlunbind(env)
- struct node *env;
- {
- struct node *bnd;
-
- for (; xlenv != env; xlenv = xlenv->n_listnext)
- {
- bnd = xlenv->n_listvalue;
- bnd->n_bndsym->n_symvalue = bnd->n_bndvalue;
- }
- }
-
-
- /**************************************
- * xlbind - bind a symbol to a value *
- **************************************/
-
- xlbind(sym,val)
- struct node *sym,*val;
- {
- struct node *lptr,*bptr;
-
- lptr = newnode(LIST); /* Create new environment list entry */
- lptr->n_listnext = xlenv;
- xlenv = lptr;
-
- lptr->n_listvalue = bptr = newnode(LIST); /* New variable binding */
- bptr->n_bndsym = sym;
- bptr->n_bndvalue = val;
- }
-
-
- /*******************************************************
- * xlfixbindings - make a new set of bindings visible *
- *******************************************************/
-
- xlfixbindings(env)
- struct node *env;
- {
- struct node *eptr,*bnd,*sym,*oldvalue;
-
- for (eptr = xlenv; eptr != env; eptr = eptr->n_listnext) {
- bnd = eptr->n_listvalue;
- sym = bnd->n_bndsym;
- oldvalue = sym->n_symvalue;
- sym->n_symvalue = bnd->n_bndvalue;
- bnd->n_bndvalue = oldvalue;
- }
- }